<script>
export default {
  data() {
    return {
		globalData:{}
	};
  },
  onLaunch() {
    wx.getSystemInfo({
      success: (res) => {
        this.globalData.statusBarHeight = res.statusBarHeight;
      },
    });
    this.checkUpdate();
  },

 methods:{
    /** 检查版本更新 */
    checkUpdate() {
    if (wx.canIUse("getUpdateManager")) {
      const updateManager = wx.getUpdateManager();
      updateManager.onCheckForUpdate((res) => {
        console.log("是否请求到新版本:" + res.hasUpdate);
      });
      updateManager.onUpdateReady(() => {
        wx.showModal({
          title: "更新提示",
          content: "新版本已经准备好，是否重启更新？",
          success: (res) => {
            if (res.confirm) {
              updateManager.applyUpdate();
            }
          },
          showCancel: false,
        });
      });
      updateManager.onUpdateFailed(() => {
        wx.showModal({
          title: "更新提示",
          content: "新版本下载失败，请重试",
          showCancel: false,
        });
      });
    } else {
      wx.showModal({
        title: "提示",
        content:
          "当前微信版本过低，无法使用该功能，请升级到最新微信版本后重试。",
      });
    }
  },
 }
};
</script>

<style lang="scss">
/*每个页面公共css */


</style>
